<?php 
$conn = mysql_connect("127.0.0.1","root","");
mysql_select_db("xingtan");
$id = mysql_real_escape_string($_GET['id']);
$title = mysql_real_escape_string($_GET['t']);
$category = mysql_real_escape_string($_GET['c']);
$level = mysql_real_escape_string($_GET['l']);

$sql = sprintf("UPDATE articles SET title = '%s', category=%s, level=%s WHERE id = %s", $title, $category, $level, $id);
print $sql;
if ($id && $title) {
  mysql_query($sql);
  printf($sql . ' update success.');
} else {
  print 'parameter error';
}
mysql_close($conn);
?>
